import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const Main = () => import("@/views/Main");
const Home = () => import("@/views/home/Home");
const Mall = () => import("@/views/mall/Mall");
const User = () => import("@/views/user/User");
const PageOne = () => import("@/views/other/pageOne");
const PageTwo = () => import("@/views/other/pageTwo");
const Login = () => import("@/views/login/Login")

const routes = [
  {
    path: "/",
    name: "Main",
    component: Main,
    redirect: "/home",
    children: [
      {
        path: '/home',
        name: 'home',
        component: Home
      },
      {
        path: '/mall',
        name: 'mall',
        component: Mall
      },
      {
        path: '/user',
        name: 'user',
        component: User
      },
      {
        path: '/page1',
        name: 'page1',
        component: PageOne
      },
      {
        path: '/page2',
        name: 'page2',
        component: PageTwo
      },
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: Login
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
